feat(sfs): add snapshot_policy_id to sfs_resource_pool#1444
feat(sfs): add snapshot_policy_id to sfs_resource_pool#1444
Conversation
relates to STACKITTPR-629
6b2aaaf to
52faacd
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
| Optional: true, | ||
| Default: objectdefault.StaticValue( | ||
| types.ObjectValueMust(snapshotPolicyTypes, map[string]attr.Value{ | ||
| "id": types.StringValue(defaultSnapshotPolicyId), |
There was a problem hiding this comment.
I would expect the API to return an error for an empty string value as a snapshot policy ID.
At least I didn't get any snapshot policy with id "" from https://docs.api.stackit.cloud/documentation/sfs/version/v1#operation/ListSnapshotPolicies
There was a problem hiding this comment.
API design is the one thing. But why to we send an empty string? I don't quite get it tbh 😅
There was a problem hiding this comment.
The snapshot policy ID is in the PATCH request optional, but not nullable. So to remove the snapshot policy from an existing resource pool, we need to set it to an empty string. The empty string, is also the default "snapshot_policy_id", when no id was set within the creation.
I set it on default to an empty string, to automatically remove the snapshot_policy_id, when someone removes the object in their terraform config. Otherwise terraform wouldn't trigger an update
There was a problem hiding this comment.
So the empty string thing is a workaround for an API issue?
Description
relates to STACKITTPR-629
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)